package io.zcoder.innoway.activities;


import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.zcoder.innoway.R;
import io.zcoder.innoway.commons.Constants;
import io.zcoder.innoway.models.Profile;
import io.zcoder.innoway.models.User;

public class SelectGenderActivity extends BaseActivity {

    public static final int MALE = 1;
    public static final int FEMALE = 2;

    @BindView(R.id.male)
    ImageView mMale;
    @BindView(R.id.female)
    ImageView mFemale;

    @OnClick(R.id.next)
    void onNext() {
        if (mProfile == null) {
            return;
        }
        Intent intent = new Intent(this, SelectBirthDayActivity.class);
        mProfile.setGender(mCurrentGender == MALE ? 1 : 0);
        intent.putExtra(Constants.PROFILE_EXTRAS, mProfile);
        startActivity(intent);
    }

    @OnClick(R.id.male)
    void selectMale() {
        mMale.setAlpha(1f);
        mFemale.setAlpha(0.3f);
        mCurrentGender = MALE;
    }

    @OnClick(R.id.female)
    void selectFemale() {
        mMale.setAlpha(0.3f);
        mFemale.setAlpha(1f);
        mCurrentGender = FEMALE;
    }

    private int mCurrentGender = FEMALE;
    private Profile mProfile;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_select_gender_activity);
        ButterKnife.bind(this);
        showBack(true);
        mProfile = getIntent().getParcelableExtra(Constants.PROFILE_EXTRAS);
    }
}
